<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <title>供应商管理</title>
    <meta name="viewport" content="width=device-width, initial-scale=1">
    <link rel="stylesheet" href="../../../component/elementUI/index.css">
    <link rel="stylesheet" href="../../../style/wangeditor.css">
    <link rel="stylesheet" href="../../../style/index.css">
</head>

<body>
    <div id="app" v-cloak>
        <el-form :inline="true" :form="form">
            <el-form-item>
                <el-button type="primary" @click="Add">新增</el-button>
            </el-form-item>
            <el-form-item>
                <el-input v-model.trim="form.Supplier_Name" clearable placeholder="请输入供应商" />
            </el-form-item>
            <el-form-item>
                <el-button type="primary" @click="onSerach">查询</el-button>
            </el-form-item>
            <el-form-item>
                <yl-button type="success" :data="ExportData" :loading="loading" @click="Export(form)">供应商导出</yl-button>
            </el-form-item>
            <el-form-item>
                <el-dropdown trigger="click" @command="downloadTemplate">
                    <el-button type="primary">
                        下载导入模板<i class="el-icon-arrow-down el-icon--right"></i>
                    </el-button>
                    <el-dropdown-menu slot="dropdown">
                        <el-dropdown-item command="Supplier">供应商模板</el-dropdown-item>
                        <el-dropdown-item command="Article">经营商品模板</el-dropdown-item>
                        <el-dropdown-item command="User">供应商联系人模板</el-dropdown-item>
                    </el-dropdown-menu>
                </el-dropdown>
            </el-form-item>
            <el-form-item>
                <el-dropdown trigger="click" @command="importTemplate">
                    <el-button type="danger">
                        批量导入<i class="el-icon-arrow-down el-icon--right"></i>
                    </el-button>
                    <el-dropdown-menu slot="dropdown">
                        <el-dropdown-item command="Supplier">导入供应商数据</el-dropdown-item>
                        <el-dropdown-item command="Article">导入供应商经营商品</el-dropdown-item>
                        <el-dropdown-item command="User">导入供应商联系人</el-dropdown-item>
                    </el-dropdown-menu>
                </el-dropdown>
            </el-form-item>
        </el-form>
        <el-table :data="tableData" stripe border height="calc(100vh - 140px)" style="width: 100%" @expand-change="expandChange">
            <el-table-column align="center" type="expand" label="联系人" width="75">
                <template slot-scope="{row}">
                    <div style="padding:0 20px;">
                        <div class="table_titel">
                            <div class="titel">联系人</div>
                        </div>
                        <el-table :data="row.Children.user_info" stripe border style="width: 100%">
                            <el-table-column align="center" type="index" label="序号" width="50"></el-table-column>
                            <el-table-column prop="ID_Name" label="联系人"></el-table-column>
                            <el-table-column prop="User_Number" label="联系方式"></el-table-column>
                            <el-table-column align="center" label="操作" width="180">
                                <template slot="header" slot-scope="scope">
                                    <el-button type="success" @click="AddUser(row)" size="small">新增联系人</el-button>
                                </template>
                                <template slot-scope="scope">
                                    <el-button type="primary" size="small" @click="EditUser(row,scope.row)">编辑</el-button>
                                    <!-- <el-dropdown size="small" trigger="click">
                                        <el-button size="small" type="primary">
                                            更多<i class="el-icon-arrow-down el-icon--right"></i>
                                        </el-button>
                                        <el-dropdown-menu slot="dropdown">
                                            <el-dropdown-item style="margin-bottom: 5px;">
                                                <el-button type="primary" size="small"
                                                    @click="Preview(row.Page_SerialNumber)">预览</el-button>
                                            </el-dropdown-item>
                                            <el-dropdown-item style="margin-bottom: 5px;">
                                                <el-button type="danger" size="small"
                                                    @click="Remove(row)">删除</el-button>
                                            </el-dropdown-item>
                                        </el-dropdown-menu>
                                    </el-dropdown> -->
                                </template>
                            </el-table-column>
                        </el-table>
                    </div>
                </template>
            </el-table-column>
            <el-table-column prop="Supplier_SerialNumber" label="供应商编号"></el-table-column>
            <el-table-column prop="Supplier_Name" label="供应商名称"></el-table-column>
            <el-table-column prop="Supplier_Address" label="地址"></el-table-column>
            <el-table-column align="center" label="操作" width="180">
                <template v-slot="{row}">
                    <el-button type="primary" size="small" @click="Edit(row.Supplier_SerialNumber)">编辑</el-button>
                    <el-button type="danger" size="small" @click="Remove(row)">删除</el-button>
                </template>
            </el-table-column>
        </el-table>
        <el-pagination style="margin-top: 5px;" background @size-change="handleSizeChange"
            @current-change="handleCurrentChange" :current-page="form.page" :page-sizes="[ 20, 30, 50,100]"
            :page-size="form.limit" layout="total, sizes, prev, pager, next, jumper" :total="total">
        </el-pagination>
        <add-user :visible.sync="visibleAddUser" :id="Supplier_SerialNumber" @success="expandChange(supplier)"></add-user>
        <edit-user :visible.sync="visibleEditUser" :User="user" :id="Supplier_SerialNumber" @success="expandChange(supplier)"></edit-user>
    </div>
    <script type="text/javascript" src="../../../utils/wangeditor.js"></script>
    <script type="text/javascript" src="../../../utils/jquery.min.js"></script>
    <script type="text/javascript" src="../../../utils/jquery.cookie.js"></script>
    <script type="text/javascript" src="../../../utils/vue.min.js"></script>
    <script type="text/javascript" src="../../../utils/vuex.min.js"></script>
    <script type="text/javascript" src="../../../component/elementUI/index.js"></script>
    <script type="text/javascript" src="../../../component/component.js"></script>
    <script type="text/javascript" src="../../../config/config.js"></script>
    <script type="text/javascript" src="../../../utils/FileSaver.min.js"></script>
    <script type="text/javascript" src="../../../utils/FileSaver.js"></script>
    <script type="text/javascript" src="../../../utils/xlsx.full.min.js"></script>
    <script type="text/javascript" src="../../../utils/xlsx.core.min.js"></script>
    <script type="text/javascript" src="../../../utils/compressor.js"></script>
    <script type="text/javascript" src="../../../utils/ID_Validity.js"></script>
    <script type="text/javascript" src="../../../utils/utils.js"></script>
    <script type="text/javascript" src="js/index.js"></script>
</body>

</html>